package logic

import (
	"context"

	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/config"
	"github.com/redis/go-redis/v9"
)

func GetTokenRedis(ctx context.Context, conf config.RedisConf, key string) (ret interface{}, err error) {
	rdb := GetRedisClient(conf)
	return rdb.Get(ctx, key).Result()
}

func SetTokenRedis(ctx context.Context, conf config.RedisConf, key string, value interface{}) error {
	rdb := GetRedisClient(conf)
	_, err := rdb.Set(ctx, key, value, redis.KeepTTL).Result()
	if err != nil {
		return err
	}
	return nil
}
